HAL Common Overview

Introducing Common Driver

group HAL_Introduction

The HAL module (also called HAL generic) provides a standardized interface to simplify hardware interaction.

This file provides firmware functions to manage the following functionalities:

  • System configuration to make the device ready for other HAL modules operation

  • HAL time base (used by other HAL modules for timeout)

  • Identification features (HAL driver version, device identification data)

Module and files

The following diagram illustrates the HAL Common module and its associated files.

Module and files diagram

Component diagram

The following diagram illustrates the software components involved in the HAL common driver. It shows the interactions between the user application, HAL drivers, low-level drivers, and the hardware components.

@startuml
<style>
componentDiagram {
   arrow {
      FontSize 8
   }
}
</style>

title  Software Component Diagram

package "HAL" {
    [HAL_GENERIC]
    [HAL_CORTEX]
    [HAL_RCC]
}

package "Low Layer" {
    [LL_SYSTEM]
	[LL_UTILS]
    [LL_BUS]
    [CMSIS]
    [SysTick Interrupt routine service]
}

package "HW" {
    [STM32_HW]
}

[Appli] --> [HAL_GENERIC] : HAL generic API (HAL_Init(), HAL_Delay(), ...)
[HAL_GENERIC] --> [LL_SYSTEM] : LL API
[HAL_GENERIC] --> [LL_BUS] : LL API
[HAL_GENERIC] -r-> [HAL_CORTEX] : SysTick config
[HAL_GENERIC] -l-> [HAL_RCC] : SystemCoreClock
[HAL_GENERIC] <-- [HAL_RCC] : HAL_InitTick()
[HAL_GENERIC] <-- [SysTick Interrupt routine service]: HAL_IncTick()
[LL_SYSTEM] --> [CMSIS]: registers def
[LL_BUS] --> [CMSIS]: registers def
[LL_UTILS]
[STM32_HW] -u--> [SysTick Interrupt routine service]: SysTick Irq
[STM32_HW] <-u-- [LL_SYSTEM] : registers R/W
[STM32_HW] <-u-- [LL_BUS] : registers R/W
[STM32_HW] <-u-- [LL_UTILS] : registers R/W
@enduml

Configuration table

The following table lists the configuration defines for the HAL common module, specifying their locations, default values, and descriptions:

group HAL_Configuration_Table

Configuration inside the HAL driver

Config defines

Description

Default value

Note

USE_HAL_CHECK_PARAM

from hal_conf.h

0

Enable the runtime check parameters

USE_HAL_TICK_INT_PRIORITY

from hal_conf.h

bitfield range max

HAL tick interrupt priority (lowest by default)

USE_HAL_FLASH_PREFETCH

from hal_conf.h

0

When set, Flash prefetch is enabled